/*     */ package com.qmsk.business.manage.user.controller;
/*     */ 
/*     */ import com.qmsk.business.manage.user.dao.RegisterDAO;
/*     */ import com.qmsk.business.manage.user.dao.UserDAO;
/*     */ import com.qmsk.session.UserSessionInfo;
/*     */ import com.utils.gson.out.GsonEbRst;
/*     */ import com.utils.gson.out.GsonEbUtils;
/*     */ import com.utils.jdbc.connection.DbConnection;
/*     */ import com.utils.web.RequestUtils;
/*     */ import com.utils.web.ResponseUtils;
/*     */ import java.sql.SQLException;
/*     */ import javax.servlet.http.HttpServletRequest;
/*     */ import javax.servlet.http.HttpServletResponse;
/*     */ import javax.servlet.http.HttpSession;
/*     */ import org.apache.log4j.Logger;
/*     */ import org.springframework.beans.factory.annotation.Autowired;
/*     */ import org.springframework.stereotype.Controller;
/*     */ import org.springframework.web.bind.annotation.PathVariable;
/*     */ import org.springframework.web.bind.annotation.RequestMapping;
/*     */ 
/*     */ @Controller
/*     */ @RequestMapping({"/userlg"})
/*     */ public class UserlgController
/*     */ {
/*  32 */   private static final Logger logger = Logger.getLogger(UserlgController.class);
/*     */ 
/*     */   @Autowired
/*     */   private UserDAO dao;
/*     */ 
/*     */   @Autowired
/*     */   private RegisterDAO registerDao;
/*     */ 
/*     */   @RequestMapping(value={"register/{hardId}/{computerName}/{memo}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*     */   public void register(HttpServletRequest request, HttpServletResponse response, @PathVariable("hardId") String hardId, @PathVariable("computerName") String computerName, @PathVariable("memo") String memo)
/*     */     throws SQLException
/*     */   {
/*  97 */     Integer nByPass = this.registerDao.selectGetByPass(hardId);
/*  98 */     if (nByPass != null)
/*     */     {
/*     */       GsonEbRst gsonEbRst;
/*  99 */       if (nByPass.intValue() == 0) {
/* 100 */         gsonEbRst = 
/* 101 */           GsonEbUtils.toGsonEbRstError("客户端已经注册,但未通过审核,请联系管理员!");
/* 102 */         ResponseUtils.setResponseResult(gsonEbRst, response);
/* 103 */         return; }
/* 104 */       if (nByPass.intValue() > 0) {
/* 105 */         gsonEbRst = 
/* 106 */           GsonEbUtils.toGsonEbRstError("客户端注册已经通过,不需要再注册!");
/* 107 */         ResponseUtils.setResponseResult(gsonEbRst, response);
/* 108 */         return;
/*     */       }
/*     */     }
/*     */     try
/*     */     {
/* 113 */       int nExists = this.registerDao.insertExistsOfHardId(hardId, 
/* 114 */         computerName, memo).intValue();
/*     */ 
/* 115 */       GsonEbRst gsonEbRst = null;
/* 116 */       if (nExists > 0) {
/* 117 */         DbConnection.commit();
/* 118 */         gsonEbRst = GsonEbUtils.toGsonEbRstSuccess("注册申请成功,请等待管理员审核," + 
/* 119 */           request.getSession().getId());
/*     */       } else {
/* 121 */         DbConnection.rollback();
/* 122 */         gsonEbRst = GsonEbUtils.toGsonEbRstSuccess("注册申请失败,请联系管理员," + 
/* 123 */           request.getSession().getId());
/*     */       }
/* 125 */       ResponseUtils.setResponseResult(gsonEbRst, response);
/*     */     } catch (Exception e) {
/* 127 */       DbConnection.rollback();
/* 128 */       logger.error(e);
/* 129 */       ResponseUtils.setErrorMsgResponse(
/* 130 */         RequestUtils.getSqlInsertDataErrorMessage(request) + ":" + 
/* 131 */         e.getMessage(), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @RequestMapping(value={"logout"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*     */   public void logout(HttpServletRequest request, HttpServletResponse response) {
/* 137 */     UserSessionInfo.request_logout(request);
/*     */   }
/*     */ }

/* Location:           C:\Users\Administrator\Desktop\新建文件夹\WEB-INF\classes\
 * Qualified Name:     com.qmsk.business.manage.user.controller.UserlgController
 * JD-Core Version:    0.5.3
 */